define(function(require){
	var $ = require("jquery");
	var justep = require("$UI/system/lib/justep");

	var Model = function(){
		this.callParent();
	};

	Model.prototype.doLoginBtnClick = function(event){
	    var me = this;
	    var userName = this.comp("username").val();
	    var password = this.comp("password").val();
	    if(userName&&password){
	        var url = "http://101.201.49.208:8080/ex_community/a/api/community/login?callback=?";
			$.getJSON(
				url,
				{
//					username:userName,
//					password:password	
					username:"xiaguoqiang",
					password:"123456"				
				},
				function(data,status){
				    
				   if(!jQuery.isEmptyObject(data)){
				       console.log("user",data);
					   localStorage.setItem("userInfo",JSON.stringify(data));
					   if(me.owner.getXid()=="mineContainer"){
						   me.owner.setSrc("$UI/communityOto/mine/mineFragment.w");
						  
					   }else if(me.owner.getXid()=="communityContainer"){
					        
						    me.owner.setSrc("$UI/communityOto/community/community.w");
					   }
					    me.owner.refresh();
					 
				   }else{
					  justep.Util.hint("用户名或密码错误",{
				    		type:"danger"
				    	}); 
				   }								
				}					
			);
	    }else{
	    	justep.Util.hint("用户名或密码不能为空",{
	    		type:"danger"
	    	});
	    }
	   
        

	};

	
	Model.prototype.backBtnClick = function(event){
		//location.href=require.toUrl("$UI/CommunityOto/index.w?device=m#!main//(#!content1/!/mine)");
		//this.comp("loginReceiver").windowEnsure({action:"close"});
	};

	



	

	return Model;
});